//
//  HPCustomerWardrobeDataSource.m
//  HappyPenguin
//
//  Created by zhuangyihang on 1/10/16.
//  Copyright © 2016 zhuangyihang. All rights reserved.
//

#import "HPCustomerWardrobeDataSource.h"
#import "HPPhotoMainCell.h"
#import "VipUserWardrobeObject.h"

@interface HPCustomerWardrobeDataSource()<UICollectionViewDataSource,UICollectionViewDelegate>

@property (nonatomic, strong) UICollectionView *collectionView;

@end

@implementation HPCustomerWardrobeDataSource

- (id)initWithTableView:(UICollectionView *)collectionView{
    self = [super init];
    if (self) {
        self.collectionView = collectionView;
        [self.collectionView registerClass:[HPPhotoMainCell class] forCellWithReuseIdentifier:@"HPPhotoMainCell"];
        
        self.collectionView.delegate = self;
        self.collectionView.dataSource = self;
        

    }
    return self;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return self.datas.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    HPPhotoMainCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HPPhotoMainCell"
                                                                                     forIndexPath:indexPath];
    
    VipUserWardrobeObject *obj = [self.datas objectAtIndex:indexPath.row];
    [cell.coverView sd_setImageWithURL:[obj getUrl]];
    return cell;
}

@end
